checkbutton: Don't redundantly update states
authorBenjamin Otte <otte@redhat.com>
Sun, 17 Aug 2014 01:19:59 +0000 (03:19 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 17 Aug 2014 01:19:59 +0000 (03:19 +0200)
States are set properly by GtkButton, there is no need to set them
manually.

gtk/gtkcheckbutton.c
gtk/gtkradiobutton.c

index 08c2260e0853153dde732158f6871f36c17cb33a..47dc6bb10021b2973545d78b11544f62e4f2d978 100644 (file)
@@ -529,7 +529,6 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
 {
   GtkWidget *widget;
   GtkButton *button;
-  GtkStateFlags state = 0;
   gint x, y;
   gint indicator_size;
   gint indicator_spacing;
@@ -544,7 +543,6 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
   gtk_widget_get_allocation (widget, &allocation);
   baseline = gtk_widget_get_allocated_baseline (widget);
   context = gtk_widget_get_style_context (widget);
-  state = gtk_widget_get_state_flags (widget);
 
   _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
 
@@ -557,20 +555,10 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
     y = CLAMP (baseline - indicator_size * button->priv->baseline_align,
               0, allocation.height - indicator_size);
 
-  state &= ~(GTK_STATE_FLAG_ACTIVE |
-             GTK_STATE_FLAG_PRELIGHT);
-
-  if (button->priv->activate_timeout || (button->priv->button_down && button->priv->in_button))
-    state |= GTK_STATE_FLAG_ACTIVE;
-
-  if (button->priv->in_button)
-    state |= GTK_STATE_FLAG_PRELIGHT;
-
   if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
     x = allocation.width - (indicator_size + x);
 
   gtk_style_context_save (context);
-  gtk_style_context_set_state (context, state);
 
   gtk_render_background (context, cr,
                          border_width, border_width,
index 69aab76f541dd08c34c352a7c7c4be395adfaa63..f61a361e151a70e1888e16918b554c0f1337aadc 100644 (file)
@@ -831,7 +831,6 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
   GtkWidget *widget;
   GtkButton *button;
   GtkStyleContext *context;
-  GtkStateFlags state = 0;
   gint x, y;
   gint indicator_size, indicator_spacing;
   gint baseline;
@@ -840,7 +839,6 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
   widget = GTK_WIDGET (check_button);
   button = GTK_BUTTON (check_button);
   context = gtk_widget_get_style_context (widget);
-  state = gtk_widget_get_state_flags (widget);
 
   border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   _gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
@@ -855,21 +853,10 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
     y = CLAMP (baseline - indicator_size * button->priv->baseline_align,
               0, allocation.height - indicator_size);
 
-  state &= ~(GTK_STATE_FLAG_ACTIVE |
-             GTK_STATE_FLAG_PRELIGHT);
-
-  if (button->priv->activate_timeout ||
-      (button->priv->button_down && button->priv->in_button))
-    state |= GTK_STATE_FLAG_ACTIVE;
-
-  if (button->priv->in_button)
-    state |= GTK_STATE_FLAG_PRELIGHT;
-
   if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
     x = allocation.width - (indicator_size + x);
 
   gtk_style_context_save (context);
-  gtk_style_context_set_state (context, state);
 
   gtk_render_background (context, cr,
                          border_width, border_width,